package com.vayne;

/**
 * @author xuerui.zhang
 * @since 2020/4/19 上午11:15
 */
public class VarintsDemo {

    public static void main(String[] args) {
        System.out.println(sizeOfLong(1));
        System.out.println(sizeOfLong(-1));
    }

    public static int sizeOfLong(int v) {
        System.out.println("input v：" + v);
        int bytes = 1;
        while ((v & 0xffffffffffffff80L) != 0L) {
            bytes += 1;
            v >>>= 7;
        }
        System.out.println("return bytes：" + bytes);
        return bytes;
    }
}